<!DOCTYPE html>
<?php
	session_start();
	$order = $_SESSION['cart'];
	$num = 0; 
?>
<html>
<head>
	<meta charset="utf-8">
	<link rel="stylesheet" type="text/css" href="css/style.css">
	<title>我的购物车</title>
</head>
<body>
	<div class="container">
		<h1>购物车</h1>
		<hr>
		<a href="index.php" title="返回商品列表">←商品列表</a>
		<table>
			<tr>
				<th>商品名</th>
				<th>售价</th>
				<th>数量</th>
			</tr>
			<!-- 遍历商品数组，显示商品信息 -->
			<?php foreach ($order as $key => $value) :?>
			<tr>
				<td><?php echo $value['name'] ?></td>
				<!-- 商品名 -->
				<td class="price">￥<?php echo $value['price'] ?></td>
				<!-- 售价 -->
				<td>
					<a class="btn sub" href="updCart.php?upd=0&id=<?php echo $value['id']; ?>">-</a>
					<?php echo $value['num']; ?>
					<!-- 商品数量 -->
					<a class="btn add" href="updCart.php?upd=1&id=<?php echo $value['id']; ?>">+</a>
				</td>
			</tr>
			<?php endforeach; ?>
			<tr>
				<td colspan="4">
					<form action="updCart.php" method="get">   <!-- 第（7）空 -->
						<input type="submit" value="结算">   <!-- 第（8）空 -->
					</form>
				</td>
			</tr>
		</table>
	</div>
</body>
</html>